using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Spawner_Left : MonoBehaviour
{
    public GameObject carPrefab;
    private Vector2 spawnPoint;
    public GameObject carList;

    float times = 5f;


    void Start()
    {
        spawnPoint = transform.position;
    }


    void Update()
    {
        times -= Time.deltaTime;
        if (times < 0 && GameManager.Instance.IsGamePlaying())
        {
            GameObject spwanObj = Instantiate(carPrefab, spawnPoint, Quaternion.identity);

            //Instantiate(carPrefab, spawnPoint, Quaternion.identity);
            spwanObj.transform.parent = carList.transform;
            times = Random.Range(5, 10);
        }
    }
}
